

function say() {
    alert("LC:17. 电话号码的字母组合");
}
say();



/**
 * @param {string} digits
 * @return {string[]}
 */
var letterCombinations = function(digits) {
    //3:03-13  递归 坚韧不拔
    if(digits.length == 0){
        return []
    }

    var dic = {
        2:'abc',
        3:'def',
        4:'ghi',
        5:'jkl',
        6:'mno',
        7:'pqrs',
        8:'tuv',
        9:'wxyz',
    }

    var res = []

    var dfs = (str, idx) => {
        if(idx >= digits.length){
            res.push(str)
            return
        }

        var val = dic[digits[idx]]
        for(var i = 0; i < val.length; i++){
            var nstr = val[i]
            dfs(str + nstr, idx + 1)
        }
    }


    dfs('', 0)

    return res
};
